package com.faradel.pharmapp.service;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.faradel.pharmapp.entities.PatientOrder;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.faradel.pharmapp.dao.PatientOrderDAO;

@Repository("patientOrderServiceImpl")
public class PatientOrderServiceImpl implements PatientOrderServiceInterface
{
    @Resource
    PatientOrderDAO patientOrderDaoImpl;

    @Override
    @Transactional(readOnly = false)
    public void addPatientOrder(PatientOrder medication)
    {
        patientOrderDaoImpl.save(medication);
    }

    @Override
    @Transactional(readOnly = false)
    public void updatePatientOrder(PatientOrder order)
    {
        patientOrderDaoImpl.update(order);
    }

    @Override
    @Transactional(readOnly = false)
    public void deletePatientOrder(PatientOrder order)
    {
        patientOrderDaoImpl.delete(order);
    }

    @Override
    @Transactional(readOnly = true)
    public PatientOrder getPatientOrderById(int id)
    {
        return patientOrderDaoImpl.get(id);
    }

    @Override
    @Transactional(readOnly = true)
    public List<PatientOrder> getAllPatientOrder()
    {
        return patientOrderDaoImpl.selectAll();
    }

    @Override
    @Transactional(readOnly = true)
    public List<PatientOrder> getPatientOrderByColumns(Map<String, String> map)
    {
        return patientOrderDaoImpl.findByColumn(map);
    }

}
